﻿@using LiveChartsCore
@using LiveChartsCore.SkiaSharpView
@using SkiaSharp
@using ViewModelsSamples

<Router AppAssembly="@typeof(App).Assembly">
    <Found Context="routeData">
        <RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
        <FocusOnNavigate RouteData="@routeData" Selector="h1" />
    </Found>
    <NotFound>
        <PageTitle>Not found</PageTitle>
        <LayoutView Layout="@typeof(MainLayout)">
            <p role="alert">Sorry, there's nothing at this address.</p>
        </LayoutView>
    </NotFound>
</Router>

@code {
    protected override void OnInitialized()
    {
        // LiveCharts configuration section: // mark
        LiveCharts.Configure(c => c // mark
            .AddLiveChartsAppSettings()); // mark
    }

    // protected override async Task OnInitializedAsync()
    // {
    //     // or async initialization, for example to load a font that supports Chinese characters

    //     var httpClient = new HttpClient { BaseAddress = new("https://localhost:7277") };
    //     var fontStream = await httpClient.GetStreamAsync("Source Han Sans CN Light.otf");
    //     var typeface = SKTypeface.FromStream(fontStream);

    //     Console.WriteLine(typeface);

    //     LiveCharts.Configure(config =>
    //         config.HasTextSettings(new TextSettings
    //         {
    //             DefaultTypeface = typeface
    //         }));
    // }
}
